package com.ruoyi.remark.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.remark.mapper.BoleRemarkProjectMapper;
import com.ruoyi.remark.domain.BoleRemarkProject;
import com.ruoyi.remark.service.IBoleRemarkProjectService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 标注提交记录Service业务层处理
 * 
 * @author wujiale
 * @date 2025-04-19
 */
@Service
public class BoleRemarkProjectServiceImpl implements IBoleRemarkProjectService 
{
    @Autowired
    private BoleRemarkProjectMapper boleRemarkProjectMapper;

    @Autowired
    private SysUserMapper userService;

//    @Autowired

    @Override
    public List<BoleRemarkProject> selectBoleRemarkProjectByIds(List<Long> ids) {
        return boleRemarkProjectMapper.selectBoleRemarkProjectByIds(ids);
    }

    @Override
    public int userAdd(BoleRemarkProject boleRemarkProject) {
        boleRemarkProject.setCreateTime(DateUtils.getNowDate());
        return boleRemarkProjectMapper.insertBoleRemarkProject(boleRemarkProject);
    }

    /**
     * 修改标注提交记录
     *
     * @param boleRemarkProject 标注提交记录
     * @return 结果
     */
    @Transactional
    @Override
    public int checkRemarkProject(BoleRemarkProject boleRemarkProject)
    {
        //负责人审核
        if (boleRemarkProject.getStatus().equals("3")){
            //工作量真的加
            System.out.println(boleRemarkProject.getWorkload());
            int result =   userService.updateRemarkWorkload(boleRemarkProject.getWorkload(), boleRemarkProject.getUserId());
        }
        boleRemarkProject.setUpdateTime(DateUtils.getNowDate());
        return boleRemarkProjectMapper.updateBoleRemarkProject(boleRemarkProject);
    }
    /**
     * 查询标注提交记录
     * 
     * @param submitId 标注提交记录主键
     * @return 标注提交记录
     */
    @Override
    public BoleRemarkProject selectBoleRemarkProjectBySubmitId(Long submitId)
    {
        return boleRemarkProjectMapper.selectBoleRemarkProjectBySubmitId(submitId);
    }

    /**
     * 查询标注提交记录列表
     * 
     * @param boleRemarkProject 标注提交记录
     * @return 标注提交记录
     */
    @Override
    public List<BoleRemarkProject> selectBoleRemarkProjectList(BoleRemarkProject boleRemarkProject)
    {
        return boleRemarkProjectMapper.selectBoleRemarkProjectList(boleRemarkProject);
    }

    /**
     * 新增标注提交记录
     * 
     * @param boleRemarkProject 标注提交记录
     * @return 结果
     */
    @Override
    public int insertBoleRemarkProject(BoleRemarkProject boleRemarkProject)
    {
        boleRemarkProject.setCreateTime(DateUtils.getNowDate());
        return boleRemarkProjectMapper.insertBoleRemarkProject(boleRemarkProject);
    }

    /**
     * 修改标注提交记录
     * 
     * @param boleRemarkProject 标注提交记录
     * @return 结果
     */
    @Override
    public int updateBoleRemarkProject(BoleRemarkProject boleRemarkProject)
    {
        boleRemarkProject.setUpdateTime(DateUtils.getNowDate());
        return boleRemarkProjectMapper.updateBoleRemarkProject(boleRemarkProject);
    }

    /**
     * 批量删除标注提交记录
     * 
     * @param submitIds 需要删除的标注提交记录主键
     * @return 结果
     */
    @Override
    public int deleteBoleRemarkProjectBySubmitIds(Long[] submitIds)
    {
        return boleRemarkProjectMapper.deleteBoleRemarkProjectBySubmitIds(submitIds);
    }

    /**
     * 删除标注提交记录信息
     * 
     * @param submitId 标注提交记录主键
     * @return 结果
     */
    @Override
    public int deleteBoleRemarkProjectBySubmitId(Long submitId)
    {
        return boleRemarkProjectMapper.deleteBoleRemarkProjectBySubmitId(submitId);
    }
}
